import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Home from '../views/home/index.vue'
import Car from "../views/home/car/index.vue"
import Class from "../views/home/class/index.vue"
import My from "../views/home/my/index.vue"
import Detail from "../views/detail/index.vue"
Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/home',
    name: '首页',
    component: Home,
    children:[{
      path: '/home/car',
      name: '购物车',
      component: Car,
    },  {
    path: '/home/class',
    name: '分类',
    component: Class
  },  {
    path: '/home/my',
    name: '我的',
    component: My
  }]
  },{
    path:"/detail",
    name:"detail",
    component: Detail

  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
